<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="(item, index) in newslist" :key="index">
                <router-link :to="'/home/newsinfo/'+item.id">
                    <img class="mui-media-object mui-pull-left" :src="item.img_url">
                    <div class="mui-media-body">
                        {{item.title}}
                        <p class='mui-ellipsis'>{{item.zhaiyao}}</p>
                        <span>发表时间：{{item.add_time | dateFormat}}</span>
                        <span>点击：{{item.click}}次</span>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
import {Toast} from 'mint-ui'
export default {
    data() {
        return {
            newslist: []
        }
    },
    methods: {
        getNewsList(){
            this.$http.get('output/news/index.php').then(result => {
                if (result.body.status===0) {
                    this.newslist=result.body.message
                }else{
                    Toast("加载失败。。。")
                }
            })
        }
    },
    created() {
        this.getNewsList()
    }
}
</script>

<style lang="scss" scoped>
.mui-media-body{
    color: rgb(110, 164, 236);
    font-weight: bolder;
    .mui-ellipsis{
        color: black;
        font-weight: normal;
    }
    span{
        font-size: 12px;
        color: #8f8f94;
        font-weight: normal;
        display: flex;
        justify-content: space-between;
    }
    
}
.mui-table-view .mui-media-object{
    width: 42px;
}
</style>
